home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-02-27 | 1.1 KB | 59 lines | [TEXT/CWIE] |
- /* SK8 © 1997 Apple Computer, Inc.
- This code is protected under the current SK8 License
- See http://sk8.research.apple.com/ for more information
- Apple Research Laboratories
- */
-
-
- import java.applet.*;
-
- // Very simple sound playing utility. Assumes a sound file of extension .au exists
- // in a folder called Media where the code base is.
-
- class soundrsrc {
- // slots.
-
- private AudioClip mediadataVar;
- public String fileVar;
-
- // Constructor.
-
- soundrsrc (String file) {
- this.fileVar = file;
- }
-
- // Methods.
-
- public String file () {
- return this.fileVar;
- }
-
- public void setfile (String newvalue) {
- this.fileVar = newvalue;
- }
-
- public void loadmedia () {
- if (this.mediadataVar == null)
- this.mediadataVar = sk8.currentApplet.getAudioClip(sk8.currentApplet.getDocumentBase(), this.fileVar);
- }
-
- public void unloadmedia () {
- this.mediadataVar = null;
- }
-
- public void play () {
- this.loadmedia();
- this.mediadataVar.play();
- }
-
- public void stop () {
- this.loadmedia();
- this.mediadataVar.stop();
- }
-
- public void loop () {
- this.loadmedia();
- this.mediadataVar.loop();
- }
-
- }